package com.yjha.lzmarathonsys.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.yjha.lzmarathonsys.bean.TbPersonClockin;
import com.yjha.lzmarathonsys.dto.Param;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.yjha.lzmarathonsys.bean.TbSpecialClockin;
import com.yjha.lzmarathonsys.service.TbSpecialClockinService;
import com.yjha.lzmarathonsys.utils.PageUtils;
import com.yjha.lzmarathonsys.utils.R;
import org.springframework.web.multipart.MultipartFile;


/**
 * 专题打卡表
 *
 * @author æ­å°
 * @email 1971240051@qq.com
 * @date 2025-05-13 15:07:07
 */
@Api(tags = "专题打卡表")
@RestController
@RequestMapping("lzmarathonsys/tbspecialclockin")
// @CrossOrigin
public class TbSpecialClockinController {
    @Autowired
    private TbSpecialClockinService tbSpecialClockinService;

    /**
     * 列表
     */
    @PostMapping("/list")
    @ApiOperation("专题打卡表列表")
    //@RequiresPermissions("lzmarathonsys:tbspecialclockin:list")
    public R list(@RequestBody Param params){
            R r = tbSpecialClockinService.queryPage(params);

        return r;
    }

    /**
     * 列表
     */
    @PostMapping("/UnderZtList")
    @ApiOperation("待审核列表")
    //@RequiresPermissions("lzmarathonsys:tbspecialclockin:list")
    public R UnderZtList(@RequestBody Param params){
        R r = tbSpecialClockinService.UnderZtList(params);

        return r;
    }

    /**
     * 列表
     */
    @PostMapping("/getAll")
    @ApiOperation("专题打卡所有列表")
    //@RequiresPermissions("lzmarathonsys:tbpersonclockin:list")
    public R getAll(@RequestBody Param params){
        R r = tbSpecialClockinService.getAll(params);

        return r;
    }


    /**
     * 信息
     */
    @GetMapping("/info/{tbId}")
    @ApiOperation("专题打卡表信息")
    //@RequiresPermissions("lzmarathonsys:tbspecialclockin:info")
    public R info(@PathVariable("tbId") Integer tbId){
		R r = tbSpecialClockinService.getTbSpecialClockinById(tbId);

        return r;
    }

    /**
     * 我的专题打卡列表
     */
    @PostMapping("/myZtClockin")
    @ApiOperation("我的专题打卡记录")
    //@RequiresPermissions("lzmarathonsys:tbpersonclockin:info")
    public R myClockin(@RequestBody Param params){
        R r = tbSpecialClockinService.getmyZtClockinById(params);

        return r;
    }
    /**
     * 我的专题打卡列表
     */
    @PostMapping("/myAllList")
    @ApiOperation("根据专题查询数据集")
    //@RequiresPermissions("lzmarathonsys:tbpersonclockin:info")
    public R myAllList(@RequestBody Param param){
        PageUtils pageUtils = tbSpecialClockinService.myAllList(param);

        return R.ok().put("page",pageUtils);
    }
    /**
     * 保存
     */
    @PostMapping("/save")
    @ApiOperation("专题打卡表保存")
    //@RequiresPermissions("lzmarathonsys:tbspecialclockin:save")
    public R save(@RequestPart("tbSpecialClockin") TbSpecialClockin tbSpecialClockin,@RequestPart("Files") MultipartFile[] Files) throws Exception{
		R r = tbSpecialClockinService.saveTbSpecialClockin(tbSpecialClockin,Files);

        return r;
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    @ApiOperation("专题打卡表修改")
    //@RequiresPermissions("lzmarathonsys:tbspecialclockin:update")
    public R update(@RequestBody TbSpecialClockin tbSpecialClockin){
		tbSpecialClockinService.updateById(tbSpecialClockin);

        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    @ApiOperation("专题打卡表删除")
    //@RequiresPermissions("lzmarathonsys:tbspecialclockin:delete")
    public R delete(@RequestBody Integer[] tbIds){
		tbSpecialClockinService.removetbSpecialClockinByIds(Arrays.asList(tbIds));

        return R.ok();
    }

    /**
     * 获取经纬度的人员
     * @param tbId
     * @return
     */
    @GetMapping("/getLongitude/{tbSpecialid}")
    // @GetMapping("/getLongitude")
    @ApiOperation("获取经纬度以及打卡数量")
    // @RequiresPermissions("lzmarathonsys:tbpersonclockin:info")
    public R getLongitude(@PathVariable("tbSpecialid") Integer tbSpecialid){//@RequestBody List<String> longitudeLatitude){
    // public R getLongitude(){
        R r = tbSpecialClockinService.getLongitude(tbSpecialid);//longitudeLatitude);
        // R r = tbSpecialClockinService.getLongitude();
        return r;
    }

    /**
     * 删除
     */
    @PostMapping("/audit")
    @ApiOperation("专题打卡表审核")
    //@RequiresPermissions("lzmarathonsys:tbpersonclockin:delete")
    public R audit(@RequestBody TbSpecialClockin tbSpecialClockin){
        tbSpecialClockinService.audit(tbSpecialClockin);

        return R.ok();
    }

    /**
     * 我的专题打卡列表
     */
    @PostMapping("/dataList")
    @ApiOperation("根据专题查询数据集")
    //@RequiresPermissions("lzmarathonsys:tbpersonclockin:info")
    public R dataList(@RequestBody Param param){
        PageUtils pageUtils = tbSpecialClockinService.dataList(param);

        return R.ok().put("page",pageUtils);
    }
}
